package com.auxgroup.hr.front.commons.utils;

import java.io.Reader;

import oracle.sql.CLOB;

/**
 * @author lvliuhao
 * @version 创建时间：2018年5月29日 下午4:41:50 类字段工具类
 */
public class OracleClobUtils {

	
	/**
	 * oracle clob转成String
	 * @param clob
	 * @return
	 */
	public static String clobToString(CLOB clob){
		if(clob==null){
			return null;
		}
		StringBuilder builder = new StringBuilder();
		Reader rd;
		try {
			rd = clob.getCharacterStream();
			char [] str = new char[12];
	        while(rd.read(str) != -1) {
	            builder.append(new String(str));
	        }
			return builder.toString();
		} catch (Exception e) {
			return null;
		}
        
	}
	
}
